package com.enlf.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.enlf.entity.MenuPermission;
import com.enlf.mapper.MenuPermissionMapper;
import com.enlf.service.IMenuPermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: rensiwei
 * @data: 2024-03-19
 */
@Service
public class MenuPermissionServiceImpl extends ServiceImpl<MenuPermissionMapper, MenuPermission> implements
        IMenuPermissionService {
    @Resource
    public MenuPermissionMapper menuPermissionMapper;
    @Override
    public List<String> getMenuPermissionByUserId(Long userId) {
        List<String> menuList = new ArrayList<>();
        List<MenuPermission> menuPermissionList = menuPermissionMapper.queryMenuByUserId(userId);
        menuPermissionList.forEach(menuPermission -> {
            menuList.add(menuPermission.getMenuDesc());
        });
        return menuList;
    }
}
